package net.wofly.sale.order.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wofly.sale.commodity.domain.Commodity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

/**
 * 退货内容
 *
 * @author lign
 * @version 1.0
 * @created 06-5月-2018 11:58:47
 */
@Data
@Entity
@Table(name = "sale_order_returnsalescontent")
@ApiModel(description = "退货内容")
public class ReturnSalesContent {
    
    @Id
    private String returnSalesContentID;
    
    private String returnSalesID;
    
    private String commodityChannelID;
    private Long modifyDate;
    @ApiModelProperty(value = "退货数量")
    private Integer num;
    /**
     * 被退货的订单内容ID
     */
    private String orderContentID;
    private Double price;
    /**
     * 总价
     */
    private Double totalPrice;
    
    @Transient
    private Commodity commodity;
    
    @ApiModelProperty(value = "最大的可退回数量")
    private Integer maxReturnNum;
    
    @ApiModelProperty(value = "原始订单的单类商品总价")
    private Double initialTotalPrice;
    
    @ApiModelProperty(value = "商品的赠品")
    @OneToMany(cascade = CascadeType.MERGE,fetch = FetchType.LAZY)
    @JoinColumn(name = "returnSalesContentID")
    private List<ReturnGift> returnGifts;
    
    public ReturnSalesContent() {
    
    }
    
    @Override
    public void finalize() throws Throwable {
    
    }
}